import { PureComponent } from 'react';
import './index.less'
class Nav extends PureComponent {
    state = {
        activeIndex:0
    }
    render() {
        let {activeIndex} = this.state;
        let {explosiveMoney} = this.props;
        return (
            <div className="nav">
                {
                   explosiveMoney.map((item,index) => {
                        return (
                            <div key={item.id} className='nav_item' onClick={()=>this.ChangeActive(index,item.type)}>
                                <div className={activeIndex === index?'avtive_name':''}>
                                { item.name }
                                </div>
                                <div className={activeIndex === index?'tag active_tag':'tag'}>
                                { item.info }
                                </div>
                            </div>
                        )
                    })
                }
            </div>
        )
    }
    ChangeActive(index,type){
        this.props.getType(type)
        this.setState({
            activeIndex:index
        })
    }
}
export default Nav